﻿using System;
using System.Collections.Generic;
using System.Text;
using PPAP.Model;
using PPAP.DAO;
using System.Data;

namespace PPAP.BO
{
    public class PPARBO
    {
        public PPARBO() { }
        PPARDAO dao = new PPARDAO();
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(PPAR model)
        {
            return dao.Add(model);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int AddPP(PPAR model)
        {
            return dao.AddPP(model);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(PPAR model)
        {
            return dao.Update(model);
        }

        /// <summary>
        /// 供应商更新一条数据
        /// </summary>
        public int UpdateForSupplier(PPAR model)
        {
            return dao.UpdateForSupplier(model);
        }

        /// <summary>
        /// QE更新一条数据
        /// </summary>
        public int UpdateForQe(PPAR model)
        {
            return dao.UpdateForQe(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public int Delete(int id)
        {
            return dao.Delete(id);
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public PPAR GetModel(int id)
        {
            return dao.GetModel(id);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dao.GetList(strWhere);
        }

        /// <summary>
        /// PPAR分配QE
        /// </summary>
        /// <returns></returns>
        public DataSet GetTaskAllocation()
        {
            return dao.GetTaskAllocation();
        }

        /// <summary>
        /// 分配QE
        /// </summary>
        /// <param name="pp"></param>
        /// <returns></returns>
        public int UpdateForPPARTaskAllocation(PPAR pp)
        {
            return dao.UpdateForPPARTaskAllocation(pp);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetListForSupplier(string SupplierID)
        {
            return dao.GetListForSupplier(SupplierID);
        }

        /// <summary>
        /// 获得数据列表 供应商修改后，part输于工厂
        /// </summary>
        public DataSet GetListForSupplier2(string plantid)
        {
            return dao.GetListForSupplier2(plantid);
        }
        /// <summary>
        /// 获得数据列表 供应商修改后，管理员可以提交所有part
        /// </summary>
        public DataSet GetListForSupplier3(string supplieradmin)
        {
            return dao.GetListForSupplier3(supplieradmin);
        }

        /// <summary>
        /// CreatePPAR
        /// </summary>
        public DataSet GetListForCreate(string qeuser)
        {
            return dao.GetListForCreate(qeuser);
        }

        /// <summary>
        /// Inapplicable
        /// </summary>
        public DataSet GetListForInapplicable(string qeuser)
        {
            return dao.GetListForInapplicable(qeuser);
        }

        /// <summary>
        /// Approval
        /// </summary>
        public DataSet GetListForApproval(string username)
        {
            return dao.GetListForApproval(username);
        }

        /// <summary>
        /// ApprovalVP
        /// </summary>
        public DataSet GetListForApprovalVP(string username)
        {
            return dao.GetListForApprovalVP(username);
        }

        /// <summary>
        /// 获得已完成数据列表
        /// </summary>
        public DataSet GetListForSupplierDecided(string SupplierID)
        {
            return dao.GetListForSupplierDecided(SupplierID);
        }

        /// <summary>
        /// 获得已完成数据列表 供应商修改后，part属于工厂
        /// </summary>
        public DataSet GetListForSupplierDecided2(string Plantid)
        {
            return dao.GetListForSupplierDecided2(Plantid);
        }

        /// <summary>
        /// 获得已完成数据列表 供应商修改后，供应商管理员
        /// </summary>
        public DataSet GetListForSupplierDecided3(string supplieradmin)
        {
            return dao.GetListForSupplierDecided3(supplieradmin);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetListForPPARid(string PPARid)
        {
            return dao.GetListForPPARid(PPARid);
        }

        /// <summary>
        /// 根据pparid获取供应商所有工厂
        /// </summary>
        /// <param name="PPARid"></param>
        /// <returns></returns>
        public DataSet GetPlantListForPPARid(string PPARid)
        {
            return dao.GetPlantListForPPARid(PPARid);
        }

        /// <summary>
        /// 根据供应商ID获取供应商所有工厂
        /// </summary>
        /// <param name="PPARid"></param>
        /// <returns></returns>
        public DataSet GetPlantListForSupplierid(string Supplierid)
        {
            return dao.GetPlantListForSupplierid(Supplierid);
        }

        /// <summary>
        /// 根据ID查询工厂
        /// </summary>
        /// <param name="PlantId"></param>
        /// <returns></returns>
        public DataSet GetPlantListForPlantID(string PlantId)
        {
            return dao.GetPlantListForPlantID(PlantId);
        }

        /// <summary>
        /// Report
        /// </summary>
        public DataSet GetListForReport(string PPARid)
        {
            return dao.GetListForReport(PPARid);
        }

        public DataSet GetListForWhere(string partno, string plant, bool ok, string supplierid)
        {
            return dao.GetListForWhere(partno, plant, ok,supplierid);
        }

        /// <summary>
        /// PPARHistory
        /// </summary>
        /// <param name="partno"></param>
        /// <param name="plant"></param>
        /// <param name="ok"></param>
        /// <param name="supplierid"></param>
        /// <returns></returns>
        public DataSet GetListForWhere2(string strWhere)
        {
            return dao.GetListForWhere2(strWhere);
        }

        /// <summary>
        /// 查询统计：PPAR search
        /// </summary>
        /// <param name="ps"></param>
        /// <returns></returns>
        public DataSet GetPPARHistory(PPAP.Model.Search.PPARSearch ps)
        {
            return dao.GetPPARHistory(ps);
        }

        /// <summary>
        /// 查询统计：Sampling inspection search
        /// </summary>
        /// <param name="sis"></param>
        /// <returns></returns>
        public DataSet GetSamplingInspection(PPAP.Model.Search.SamplingInspectionSearch sis)
        {
            return dao.GetSamplingInspection(sis);
        }

        /// <summary>
        /// Sampling Report
        /// </summary>
        /// <param name="pparid"></param>
        /// <returns></returns>
        public DataSet GetReportByPPARid(string pparid)
        {
            return dao.GetReportByPPARid(pparid);
        }

        /// <summary>
        /// ReportForSearch
        /// </summary>
        /// <param name="sqlwhere"></param>
        /// <returns></returns>
        public DataSet GetReportForSearch(string sqlwhere)
        {
            return dao.GetReportForSearch(sqlwhere);
        }

        /// <summary>
        /// General
        /// </summary>
        /// <param name="partno"></param>
        /// <param name="plant"></param>
        /// <param name="ok"></param>
        /// <param name="supplierid"></param>
        /// <returns></returns>
        public DataSet GetListForGeneral(string sqlwhere)
        {
            return dao.GetListForGeneral(sqlwhere);
        }

        /// <summary>
        /// 更改设置状态
        /// </summary>
        /// <param name="pid"></param>
        /// <returns></returns>
        public int UpdateInapplicable(string pid)
        {
            return dao.UpdateInapplicable(pid);
        }
    }
}
